use raw, clear

// create subject number
gen subject  = _n
label var subject "Subject number (consecutive from 1)"

/* Subjects file: everything except budget allocations */
preserve

drop *alloc* prices*

gen age = 2016 - yearOfBirth
label var age "Age (based on self-reported year of birth)"

do ruleAnalysis

save subjects.dta, replace

/* Allocations file: only budget allocations */
restore
keep subject numCompanies *alloc* prices*
do shares
save allocations.dta, replace
